<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>智慧巴士订单管理-列表</title>
    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/jquery.cookie.js"></script>
    <script src="../../js/common.js"></script>
    <script src="../../js/layer/layer.js"></script>
    <style>
        ul li {
            list-style: none;
            display: inline-block;
        }

        #page ul li {
            width: 40px;
            height: 30px;
            line-height: 30px;
            text-align: center;
        }

        .liNomal {
            background-color: antiquewhite;
            cursor: pointer;
        }

        table {
            width: 80%;
            margin: 0 auto;
        }

        th,
        td {
            border: 1px solid #FAEBD7;
            text-align: center;
        }

        tr:hover td {
            background-color: aliceblue;
            cursor: pointer;
        }

        #page {
            text-align: center;
        }


        #new {
            margin-left: 50px;
        }

        #new input {
            width: 50px;
            height: 30px;
            line-height: 30px;
            background-color: #4476A7;
            color: #F8F8F8;
            border: 1px solid #4476A7;
            border-radius: 5px;
        }

        #new input:hover {
            background-color: #F0F8FF;
            color: #4476A7;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="new"><input type="button" value="返回" id="backBtn"/></div>
<div id="body">
    <table>
        <thead>
        <tr>
            <th>编号</th>
            <th>巴士</th>
            <th>起点</th>
            <th>终点</th>
            <th>日期</th>
        </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>
<div id="page">
    <ul></ul>
</div>
</body>
<script>
    var id ;
    $(function () {
        $("#backBtn").click(function () {
            window.location.href = baseUrl+"/back/user/list.html";
        });

        id = getUrlParam("id")
        toPage(1);
    })


    function toPage(page) {
        $.ajax({
            url: baseUrl + "bus/busOrder/list.json",
            contentType: "json",
            data: {
                page: page,
                id:id
            },
            success: function (data) {
                if (data.code == "200") {
                    //1:创建表格
                    createTable(data.pageInfo.list);
                    //2:创建页码
                    createPageInfo(data.pageInfo);
                }

            }
        })
    }

    function createTable(result) {
        $("#body table tbody").empty();
        var tbody = $("#body table tbody");
        $.each(result, function (index, bus) {
            var idTd = $("<td></td>").append(bus.id);
            var nameTd = $("<td></td>").append(bus.busId);
            var startPointTd = $("<td></td>").append(bus.startPoint);
            var endPointTd = $("<td></td>").append(bus.endPoint);
            var dateTd = $("<td></td>").append(bus.date);
            $("<tr></tr>").append(idTd).append(nameTd).append(startPointTd).append(endPointTd).append(dateTd).appendTo(tbody);
        });
    }
</script>
</html>